home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
TEX-UTIL
/
DVI_DVI1
/
dvilj
/
c
/
dvimisc
< prev
next >
Wrap
Text File
|
1996-02-28
|
26KB
|
878 lines
#include "dvilj.h"
/*-->AllDone*/
/**********************************************************************/
/****************************** AllDone ******************************/
/**********************************************************************/
void
AllDone(bool PFlag)
{
#ifdef TIMING
double time;
#endif
if (DoublePage && (PageParity==1)) { /* Shall we go around again?*/
int k;
char n[STRSIZE];
if (PrintEmptyPages && EvenPage && Reverse && PrintFirstPart) {
WouldPrint ++;
qfprintf(ERR_STREAM,"[EvenPage] ");
FormFeed();
}
#ifdef LJ
Reverse = (bool)!Reverse;
#endif
if (Reverse) {
if (!PFlag) {
FSEEK (dvifp, postambleptr, SEEK_SET);
(void) NoSignExtend(dvifp, 1);
ppagep = NoSignExtend(dvifp, 4);
}
FSEEK(dvifp, ppagep, SEEK_SET);
} else {
FSEEK(dvifp, 14l, SEEK_SET);
k = (int) NoSignExtend(dvifp, 1);
GetBytes(dvifp, n, k);
}
if (PrintSecondPart) {
if (PrintFirstPart) {
qfprintf(ERR_STREAM,"\n----------------------starting second pass\n");
#ifdef LJ
EMIT(EMTO, "\033&l2H"); EMFLUSH; /* Manual Feed */
#endif
#ifdef IBM3812
PMPout(6,"\326\001\305\300\326\252");
/* set display; ring bell; stop; clear display */
PMPflush;
#endif
}
if (PrintEmptyPages && Reverse) {
if (ZeroPage) WouldPrint++;
if ((WouldPrint%2) == 1) {
qfprintf(ERR_STREAM,"[Padding] ");
FormFeed();
}
}
WouldPrint = 0;
if (PrintEmptyPages && !Reverse && ZeroPage) {
WouldPrint++;
qfprintf(ERR_STREAM,"[ZeroPage] ");
FormFeed();
}
PageParity = 0;
PrintPages = StartPrintPages;
return;
}
}
if (EvenPage && DoublePage && !Reverse) WouldPrint++;
if (PrintEmptyPages && DoublePage && PrintSecondPart) {
if (Reverse) {
if (ZeroPage) {
WouldPrint ++;
qfprintf(ERR_STREAM,"[ZeroPage] ");
FormFeed();
}
}
else if ((WouldPrint%2) != 0) {
qfprintf(ERR_STREAM,"[Padding] ");
FormFeed();
}
}
#ifdef IBM3812
PMPout(10, "\373\010PMP.init"); /* re-init printer */
PMPflush;
if (used_fontstorage > MAXFONTSTORAGE) {
Warning("\n\7used font_storage of %s: %ld Bytes (of %ld)\7",
PRINTER, (long)used_fontstorage, (long)MAXFONTSTORAGE);
Warning("Try to format file in separate runs!");
} else
qfprintf(ERR_STREAM,
"\nAll done, used font_storage of %s: %ld Bytes (of %ld)",
PRINTER, (long)used_fontstorage, (long)MAXFONTSTORAGE);
#endif
#ifdef LJ
qfprintf(ERR_STREAM, "\nAll done, used font_storage of %s: %ld Bytes",
PRINTER, (long)used_fontstorage);
#ifdef LJ_RESIDENT_FONTS
qfprintf(ERR_STREAM, " + %d resident font%s", resident_count,
resident_count == 1 ? "" : "s");
#endif
EMIT(EMTO, "\033E"); EMFLUSH;
#ifdef LJ4
EMIT(EMTO, "\033%%-12345X"); EMFLUSH; /* what does it? */
#endif
if (PrintTestPage) {EMIT(EMTO, "\033z"); EMFLUSH;}
#ifdef vms
/* last record is not flushed to file, unless it is completely filled */
for (kk = (int)((*outfp)->_cnt); kk > 0; --kk) write_byte(outfp,'\0');
fflush(outfp);
#endif
#endif
if (!G_quiet) {
fprintf(ERR_STREAM,"\nDynamically allocated storage: %ld Bytes \n",
(long)allocated_storage);
fprintf(ERR_STREAM,"%d characters downloaded as soft fonts\n", G_ncdl);
#ifdef TIMING
#ifdef BSD_TIME_CALLS
ftime(&timebuffer);
time = (timebuffer.time + (float)(timebuffer.millitm)/1000.0)
- start_time;
#else
gettimeofday(&Tp, NULL);
time = (Tp.tv_sec + (float)(Tp.tv_usec)/1000000.0) - start_time;
#endif
if (ndone > 0) {
fprintf(ERR_STREAM,
"Time of complete run: %.2f seconds, %d page(s), %.2f seconds/page",
time, ndone, time / ndone);
fprintf(ERR_STREAM," (%.2f ppm)\n",(ndone * 60) / time);
}
fprintf(ERR_STREAM,"\n");
#endif
}
CloseFiles();
exit(G_errenc);
}
/*-->DoSpecial*/
/*********************************************************************/
/***************************** DoSpecial ***************************/
/*********************************************************************/
KeyDesc KeyTab[] = {
{ "file", String },
{ "orientation", Integer},
{ "resetpoints", String},
{ "defpoint", String},
{ "fill", String},
{ "gray", Integer},
{ "pattern", Integer},
{ "hpfile", String},
/*,
{"hsize", Dimension},
{"vsize", Dimension},
{"hoffset", Dimension},
{"voffset", Dimension},
{"hscale", Number},
{"vscale", Number}*/
};
#define NKEYS (sizeof(KeyTab)/sizeof(KeyTab[0]))
#ifdef __riscos
#ifdef LJ
/* Compare two strings, ignoring case;
s1 pointer to null-terminated keyword, s2 pointer to parseline;
returns (if successful) pointer to character following keyword in s2 */
bool StrCompare(char *s1, char *s2, char **end)
{
char *a,*b;
a = s1; b = s2;
while (*a != '\0') {
if (tolower(*a) != tolower(*b)) return(_FALSE);
a++; b++;
}
*end = b; return(_TRUE);
}
/* Read <number> integer values from string and store results in <result>. Returns number
of arguments actually read, end = pointer to char following last number */
int ParseNumbers(char *str, int *result, int number, char **end)
{
char *s;
int count=0;
s = str;
while ((*s != '\0') && (count < number))
{
while ((*s == ' ') || (*s == ',') || (*s == '=')) s++;
if (*s != '\0')
{
result[count++] = strtod(s,&s);
}
}
while ((*s == ' ') || (*s == ',') || (*s == '=')) s++;
*end = s; return(count);
}
/* Diagram commands are parsed separately since the format varies from the one
used by the other special commands */
bool ParseDiagram(char *str)
{
diagtrafo dt;
char *s,*sh;
char diagname[STRSIZE];
int results[4],no;
s = str;
while (*s == ' ') s++;
if ((StrCompare("drawfile",s,&s)) || (StrCompare("DVIview_diagram",s,&s)))
{
if (printdiag == _FALSE) {return(_TRUE);} /* it's a diagram, but don't print */
while ((*s == ' ') || (*s == '=')) s++; /* space or '=' separates keyword/keyval */
if (*s == '\0')
{
printf("No filename given for \\special-diagram!\n"); return(_TRUE);
}
sh = diagname;
while ((*s != ' ') && (*s != ',') && (*s != '\0')) *sh++ = *s++;
*sh = '\0';
/* Set up default values */
dt.scalex = 100; dt.scaley = 100;
dt.cropl = 0; dt.cropb = 0; dt.cropr = 0; dt.cropt = 0;
while (*s != '\0')
{
while ((*s == ' ') || (*s == ',')) s++;
if (*s != '\0')
{
if (StrCompare("scale",s,&s))
{
if ((no = ParseNumbers(s,results,2,&s)) != 2)
{
printf("Too few arguments (%d) given for <scale> - ignored.\n",no);
}
dt.scalex = results[0]; dt.scaley = results[1];
}
else if (StrCompare("crop",s,&s))
{
if ((no = ParseNumbers(s,results,4,&s)) != 4)
{
printf("Too few arguments (%d) given for <crop> - ignored.\n",no);
}
dt.cropl = results[0]; dt.cropr = results[1];
dt.cropt = results[2]; dt.cropb = results[3];
}
else
{
printf("Bad \\special keyword - <%s> ignored\n",s);
/* skip over this word */
while ((*s != ' ') && (*s != ',') && (*s != '=') && (*s != '\0')) s++;
}
}
}
/* printf("Diagram: %s, scale %d %d, crop %d %d %d %d\n",diagname,dt.scalex,dt.scaley,dt.cropl,dt.cropb,dt.cropr,dt.cropt);*/
diagram(diagname,&dt);
return(_TRUE);
}
else return(_FALSE);
}
#endif
#endif
void
DoSpecial(char *str, int n )
/* interpret a \special command, made up of keyword=value pairs */
{
char spbuf[STRSIZE], xs[STRSIZE], ys[STRSIZE];
char *sf = NULL;
float x,y;
long4 x_pos, y_pos;
KeyWord k;
int i, j, j1;
static int GrayScale=10, Pattern=1;
static bool GrayFill=_TRUE;
static long4 p_x[80], p_y[80];
str[n] = '\0';
spbuf[0] = '\0';
SetPosn(h, v);
#ifdef __riscos
#ifdef LJ
if (ParseDiagram(str)) return;
#endif
#endif
while ( (str = GetKeyStr(str, &k)) != NULL ) {
/* get all keyword-value pairs */
/* for compatibility, single words are taken as file names */
if ( k.vt == None && access(k.Key, 0) == 0) {
if ( sf )
Warning("More than one \\special file name given. %s ignored", sf);
(void) strcpy(spbuf, k.Key);
sf = spbuf;
/*
for (j = 1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++);
*/
} else if ( GetKeyVal( &k, KeyTab, NKEYS, &i ) && i != -1 )
switch (i) {
case PSFILE:
case HPFILE:
if ( sf )
Warning("More than one \\special file name given. %s ignored",
sf);
(void) strcpy(spbuf, k.Val);
sf = spbuf;
/*
for (j=1; ((sf[j]=='/' ? sf[j]='\\':sf[j]) != '\0'); j++) ;
*/
break;
case ORIENTATION:
#ifdef IBM3812
if ((k.v.i >= 0) && (k.v.i < 4)) {
last_ry = UNKNOWN;
sprintf(PMPformat, "\322%c", (unsigned char)k.v.i);
PMPout(2, PMPformat);
if (k.v.i == 1) Landscape = _TRUE;
else if (k.v.i == 0) Landscape = _FALSE;
#endif
#ifdef LJ
if ((k.v.i >= 0) && (k.v.i < 2)) {
last_ry = UNKNOWN;
EMIT(EMTO, "\033&l%dO\033*rF", (unsigned char)k.v.i); EMFLUSH;
#endif
} else
Warning( "Invalid orientation (%d)given; ignored.", k.v.i);
break;
case RESETPOINTS:
(void) strcpy(spbuf, k.Val);
sf = NULL;
break;
case DEFPOINT:
(void) strcpy(spbuf, k.Val);
i=sscanf(spbuf,"%d(%[^,],%s)",&j,xs,ys);
if (i>0) {
x_pos=h; y_pos=v;
if (i>1) {
if (sscanf(xs,"%fpt",&x)>0) {
fprintf(ERR_STREAM,"x = %f\n",x);
x_pos = PT_TO_DVI(x);
}
}
if (i>2) {
if (sscanf(ys,"%fpt",&y)>0) {
fprintf(ERR_STREAM,"y = %f\n",y);
y_pos = PT_TO_DVI(y);
}
}
p_x[j]=x_pos;
p_y[j]=y_pos;
} else
Warning("invalid point definition\n");
sf = NULL;
break;
case FILL:
(void) strcpy(spbuf, k.Val);
i=sscanf(spbuf,"%d/%d %s",&j,&j1,xs);
if (i>1) {
#ifdef LJ
SetPosn(p_x[j], p_y[j]);
x_pos = (long4)PIXROUND(p_x[j1]-p_x[j], hconv);
y_pos = (long4)PIXROUND(p_y[j1]-p_y[j], vconv);
if (labs(x_pos)<labs(y_pos)) x_pos=x_pos+3;
else y_pos=y_pos+3;
if (GrayFill) {
EMIT(EMTO, "\033*c%lda%ldb%dg2P", (long)x_pos, (long)y_pos, GrayScale); EMFLUSH;
} else {
EMIT(EMTO, "\033*c%lda%ldb%dg3P", (long)x_pos, (long)y_pos, Pattern); EMFLUSH;
}
last_ry = UNKNOWN;
#endif
}
break;
case GRAY:
if ((k.v.i >= 0) && (k.v.i < 101)) {
GrayScale = k.v.i;
GrayFill = _TRUE;
} else
Warning( "Invalid gray scale (%d) given; ignored.", k.v.i);
break;
case PATTERN:
if ((k.v.i >= 0) && (k.v.i < 7)) {
Pattern = k.v.i;
GrayFill = _FALSE;
} else
Warning( "Invalid pattern (%d) given; ignored.", k.v.i);
break;
default:
Warning("Can't handle %s=%s command; ignored.", k.Key, k.Val);
break;
}
else
Warning("Invalid keyword or value in \\special - <%s> ignored", k.Key);
}
if ( sf ) {
last_ry = UNKNOWN;
#ifdef IBM3812
PMPflush;
#endif
if (i==HPFILE)
CopyHPFile( sf );
else
CopyFile( sf );
}
}
/*-->GetKeyStr*/
/**********************************************************************/
/***************************** GetKeyStr ****************************/
/**********************************************************************/
/* extract first keyword-value pair from string (value part may be null)
* return pointer to remainder of string
* return NULL if none found
*/
char KeyStr[STRSIZE];
char ValStr[STRSIZE];
char
*GetKeyStr(char *str, KeyWord *kw )
{
char *s, *k, *v, t;
if ( !str )
return( NULL );
for ( s = str; *s == ' '; s++)
; /* skip over blanks */
if ( *s == '\0' )
return( NULL );
for ( k = KeyStr; /* extract keyword portion */
*s != ' ' && *s != '\0' && *s != '=';
*k++ = *s++)
;
*k = '\0';
kw->Key = KeyStr;
kw->Val = v = NULL;
kw->vt = None;
for ( ; *s == ' '; s++)
; /* skip over blanks */
if ( *s != '=' ) /* look for "=" */
return( s );
for ( s++; *s == ' '; s++); /* skip over blanks */
if ( *s == '\'' || *s == '\"' ) /* get string delimiter */
t = *s++;
else
t = ' ';
for ( v = ValStr; /* copy value portion up to delim */
*s != t && *s != '\0';
*v++ = *s++)
;
if ( t != ' ' && *s == t )
s++;
*v = '\0';
kw->Val = ValStr;
kw->vt = String;
return( s );
}
/*-->GetKeyVal*/
/**********************************************************************/
/***************************** GetKeyVal ****************************/
/**********************************************************************/
/* get next keyword-value pair decode value according to table entry */
bool
GetKeyVal(KeyWord *kw, KeyDesc tab[], int nt, int *tno)
{
int i;
char c = '\0';
*tno = -1;
for (i = 0; i < nt; i++)
if ( IsSame(kw->Key, tab[i].Entry) ) {
*tno = i;
switch ( tab[i].Typ ) {
case None:
if ( kw->vt != None )
return( _FALSE );
break;
case String:
if ( kw->vt != String )
return( _FALSE );
break;
case Integer:
if ( kw->vt != String )
return( _FALSE );
if ( sscanf(kw->Val, "%d%c",
&(kw->v.i), &c) != 1
|| c != '\0' )
return( _FALSE );
break;
/* case Number:
* case Dimension:
* if( kw->vt != String ) return( _FALSE );
* if( sscanf(kw->Val,"%f%c",
* &(kw->v.n), &c) != 1
* || c != '\0' ) return( _FALSE );
* break;
*/
}
kw->vt = tab[i].Typ;
return( _TRUE );
}
return( _TRUE );
}
/*-->IsSame*/
/**********************************************************************/
/******************************* IsSame *****************************/
/**********************************************************************/
bool /* compare strings, ignore case */
IsSame(char *a, char *b)
{
char *x, *y;
x = a;
y = b;
for ( ; *a != '\0'; a++,b++)
if ( tolower(*a) != tolower(*b) )
return( _FALSE );
return( *x == *y ? _TRUE : _FALSE );
}
/*-->FindPostAmblePtr*/
/**********************************************************************/
/************************ FindPostAmblePtr **************************/
/**********************************************************************/
void
FindPostAmblePtr(long4 *postambleptr)
/* this routine will move to the end of the file and find the start
of the postamble */
{
long4 i;
FSEEK (dvifp, 0l, SEEK_END); /* goto end of file */
*postambleptr = FTELL (dvifp) - 4;
FSEEK (dvifp, *postambleptr, SEEK_SET);
while (_TRUE) {
FSEEK (dvifp, --(*postambleptr), SEEK_SET);
if (((i = NoSignExtend(dvifp, 1)) != 223) &&
(i != DVIFORMAT))
Fatal ("Bad end of DVI file");
if (i == DVIFORMAT)
break;
}
FSEEK (dvifp, (*postambleptr) - 4, SEEK_SET);
(*postambleptr) = NoSignExtend(dvifp, 4);
FSEEK (dvifp, *postambleptr, SEEK_SET);
}
unsigned char
skip_specials(long4 *pkloc )
{
long4 i, j;
register unsigned char flag_byte;
do {
flag_byte = (unsigned char) NoSignExtend(pxlfp, 1);
/*
fprintf(ERR_STREAM,"flagbyte = %d, pkloc=%ld\n",(int)flag_byte,(long)*pkloc);
*/
(*pkloc) ++;
if (flag_byte >= 240)
switch (flag_byte) {
case 240:
case 241:
case 242:
case 243 : {
i = 0 ;
for (j = 240; j <= (long4)flag_byte; j++) {
i = 256 * i + NoSignExtend(pxlfp, 1) ;
(*pkloc) ++;
}
for (j = 1; j <= i; j++) {
(void) NoSignExtend(pxlfp, 1) ;
(*pkloc) ++;
}
break;
}
case 244 : {
i = NoSignExtend(pxlfp, 4);
(*pkloc) += 4;
break;
}
case 245 :
break;
case 246 :
break ;
case 247:
case 248:
case 249:
case 250:
case 251:
case 252:
case 253:
case 254:
case 255: {
Fatal("Unexpected flagbyte %d!\n",
(int)flag_byte) ;
}
}
} while (!((flag_byte < 240) || (flag_byte == PK_POST))) ;
return(flag_byte);
}
/*-->ReadPostAmble*/
/**********************************************************************/
/************************** ReadPostAmble ***************************/
/**********************************************************************/
/***********************************************************************
This routine is used to read in the postamble values. It
initializes the magnification and checks the stack height prior to
starting printing the document.
***********************************************************************/
void
ReadPostAmble(bool load)
{
FindPostAmblePtr (&postambleptr);
if (NoSignExtend(dvifp, 1) != POST)
Fatal ("POST missing at head of postamble");
#ifdef DEBUG
if (Debug)
fprintf(ERR_STREAM,"got POST command\n");
#endif
ppagep = NoSignExtend(dvifp, 4);
num = NoSignExtend(dvifp, 4);
den = NoSignExtend(dvifp, 4);
mag = NoSignExtend(dvifp, 4);
if ( usermag > 0 && usermag != mag )
Warning("DVI magnification of %ld over-ridden by user (%ld)",
(long)mag, (long)usermag );
if ( usermag > 0 )
mag = usermag;
hconv = DoConv(num, den, hconvRESOLUTION);
vconv = DoConv(num, den, vconvRESOLUTION);
(void) NoSignExtend(dvifp, 4); /* height-plus-depth of tallest page */
(void) NoSignExtend(dvifp, 4); /* width of widest page */
if (NoSignExtend(dvifp, 2) >= STACK_SIZE)
Fatal ("Stack size is too small");
(void) NoSignExtend(dvifp, 2); /* this reads the number of pages in */
/* the DVI file */
#ifdef DEBUG
if (Debug)
fprintf(ERR_STREAM,"now reading font defs");
#endif
if (load)
GetFontDef ();
}
#ifdef IBM3812
/*-->PMPLine*/
/**********************************************************************/
/***************************** PMPLine ******************************/
/**********************************************************************/
void /* drawing lines on the 3812 using PMP vector commands */
PMPLine(int w, int y, int x)
{
if ((w == 0) || ((x == 0) && (y == 0)))
return;
/*
fprintf(ERR_STREAM,"w=%d / %d - %d, y=%d / %d - %d, x=%d / %d - %d\n",
w,(char)(w & 0xff),(int)((signed_char)(w & 0xff)),
y,(char)(y & 0xff),(int)((signed_char)(y & 0xff)),
x,(char)(x & 0xff),(int)((signed_char)(x & 0xff)));
*/
if ( (((signed_char)(x & 0xff)) == x ) &&
( ((signed_char)(y & 0xff)) == y ) ) {
PMPcont(6);
PMPout(1, "\370");
EMITWORD(3); /* length of vector */
PMPoutC((unsigned char)(0x80 | 0x00 | (unsigned char) w));
PMPoutC((signed_char)(y & 0xff));
PMPoutC((signed_char)(x & 0xff));
/*
fprintf(ERR_STREAM,"F8 00 03: w=%d, x=%d(%d-%.2X), y=%d(%d-%.2X),\n",
w,x,(char)(x & 0xff),(signed_char)(x & 0xff),
y,(char)(y & 0xff),(signed_char)(y & 0xff));
*/
} else {
PMPcont(8);
PMPout(1, "\370");
EMITWORD(4 + 1); /* length of vector */
PMPoutC((unsigned char)(0xC0 | 0x00 | (unsigned char) w));
EMITWORD(y);
EMITWORD(x);
/*
fprintf(ERR_STREAM,"F8 00 05: w=%d, x=%d, y=%d,\n", w,x,y);
*/
}
}
#endif
/*-->SetRule*/
/**********************************************************************/
/***************************** SetRule ******************************/
/**********************************************************************/
void /* this routine will draw a rule */
SetRule(long4 a, long4 b, int Set)
{
long4 xx, yy;
#ifdef IBM3812
short hor_offset, vert_offset, ll;
#endif
if ( a > 0 && b > 0 ) {
SetPosn(h, v); /* lower left corner */
xx = (long4)PIXROUND(b, hconv); /* width */
yy = (long4)PIXROUND(a, vconv); /* height */
#ifdef DEBUG
if (Debug)
fprintf(ERR_STREAM,"Rule xx=%ld, yy=%ld\n", (long)xx, (long)yy);
#endif
#ifdef IBM3812
hor_offset = (short)(last_ry - yy);
if (hor_offset < 0) yy += hor_offset;
if (last_rx < 0) xx += last_rx;
if (Landscape) {
if (last_ry > MAX_PAGE_WIDTH) yy += MAX_PAGE_WIDTH-last_ry;
hor_offset = (short)(MAX_PAGE_HEIGHT - (last_rx + xx));
} else {
if (last_ry > MAX_PAGE_HEIGHT) yy += MAX_PAGE_HEIGHT-last_ry;
hor_offset = (short)(MAX_PAGE_WIDTH - (last_rx + xx));
}
if (hor_offset < 0) xx += hor_offset;
if ((xx > 31) && (yy > 31)) {
/*
* fill area by multiple lines (kind of a mess)
* process for simplicity always horizontally
*/
/* fprintf(ERR_STREAM, "large box: w=%d, x=%d, y=%d\n",(int)yy,(int)xx,0);*/
hor_offset = HOR_HALF(30);
MoveHor(hor_offset);
vert_offset = VERT_HALF(30);
MoveVert(-vert_offset);
ll = (short)xx - 30;
for (; yy > 30; yy -= 30) {
PMPLine(30, 0, ll);
MoveHor(-ll);
MoveVert(-30);
}
hor_offset = -hor_offset + HOR_HALF(yy);
MoveHor(hor_offset);
vert_offset = (vert_offset - 30) + VERT_HALF(yy);
MoveVert(-vert_offset);
PMPLine((int)yy, 0, (int)(xx - yy));
} else if ( (yy < xx) && (xx > 0) ) {
/* fprintf(ERR_STREAM, "hori rule: w=%d, x=%d, y=%d\n",(int)yy,(int)(xx-yy),0);*/
hor_offset = HOR_HALF(yy);
vert_offset = VERT_HALF(yy);
MoveHor(hor_offset);
MoveVert(-vert_offset);
PMPLine((int)yy, 0, (int)(xx - yy));
} else if ( (xx < yy) && (yy > 0)) {
hor_offset = HOR_HALF(xx);
vert_offset = VERT_HALF(xx);
/*
fprintf(ERR_STREAM, "move: x=%d, y=%d\n",hor_offset,-vert_offset);
fprintf(ERR_STREAM, "vert rule: w=%d, x=%d, y=%d\n",(int)xx,0,(int)-(yy-xx));
*/
MoveHor(hor_offset);
MoveVert(-vert_offset);
PMPLine((int)xx, (int)-(yy - xx), 0);
} else if (xx == yy) {
short y0; /* small square box!! */
y0 = (short)yy / 2;
hor_offset = HOR_HALF(y0);
MoveHor(hor_offset);
vert_offset = VERT_HALF(y0);
MoveVert(-vert_offset);
ll = (short)xx - y0;
PMPLine((int)y0, 0, ll);
hor_offset = -(ll + hor_offset);
vert_offset = (y0 - vert_offset);
yy -= (long4)y0;
hor_offset += HOR_HALF(yy);
MoveHor(hor_offset);
vert_offset += VERT_HALF(yy);
MoveVert(-vert_offset);
PMPLine((int)yy, 0, (int)xx - yy);
}
#endif
#ifdef LJ
if (last_ry + 1 < yy) yy = last_ry + 1;
if (last_rx < 0) xx += last_rx;
if (((int)pgsiz_dots >0) && ((int)last_ry > (int)pgsiz_dots))
yy += (long4)pgsiz_dots - (long4)last_ry;
if ((yy>0) && (xx>0)) {
EMIT(EMTO, "\033*p-%ldY\033*c%lda%ldbP", (long)yy - 1, (long)xx, (long)yy);
EMFLUSH;
}
#endif
last_ry = UNKNOWN; /* next time full positioning */
}
if (Set)
h += b;
}
/*-->FormFeed*/
/**********************************************************************/
/***************************** FormFeed ******************************/
/**********************************************************************/
void
FormFeed(void)
{
#ifdef IBM3812
unsigned short pages;
if ( (ndone == 0) && (FirstAlternate)){
for (pages = 1; pages < ncopies; pages++) {
PMPout(2, "\321\300"); /* PMP-command xD1C0 */
}
PMPout(2, "\321\100"); /* PMP-command xD140 */
} else {
for (pages = 1; pages < ncopies; pages++){
PMPout(2, "\321\200"); /* PMP-command xD180 */
}
PMPout(2, "\321\0"); /* PMP-command xD100 */
}
#endif
#ifdef LJ
EMITC('\f');
#endif
}